local ResMgr = class("ResMgr");
function ResMgr:ctor()
    self.wndformat = "csd/%s.json";
	self.pngformat = "png/%s.png";
    self.plistformat = "plist/%s";
    self.armformat = "arm/%s";
    self.spine = "spine/%s";
    self.map = "map/%s/map.tmx";
    self.c3b = "c3b/%s.c3b";
end

function ResMgr:loadImgTo(sprite,fileName)
    sprite:setTexture(self:getPngPath(fileName));
end

function ResMgr:getWndPath(name)
	return string.format(self.wndformat,name);
end

function ResMgr:getPngPath(name)
	return string.format(self.pngformat,name);
end

function ResMgr:getPlistPath(name)
    return string.format(self.plistformat,name);
end

function ResMgr:getArmPath(name)
    return string.format(self.armformat,name);
end

function ResMgr:getSpinePath(name)
    return string.format(self.spine,name);
end
function ResMgr:getMapPath(name)
    return string.format(self.map,name);
end

function ResMgr:getC3bPath(name)
    -- body
    return string.format(self.c3b,name);
end

function ResMgr:getCurDirPath(path)
	local CURRENT_MODULE = path;
	local dotindex = string.find(CURRENT_MODULE, "%.%w+$");
	local currentpath = string.sub(CURRENT_MODULE, 1, dotindex-1);
	return currentpath;
end


mgrs.res = nil;
mgrs.singleClass(mgrs,ResMgr,"res");